<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
   
    var arr = [0,1,0,2,0,3,0,4,5,0];

    function qu0(arr){
      var newArr = [];
      for (var i = 0; i < arr.length; i++) {
        if (arr[i] !== 0) {
          newArr.push(arr[i]);
        }
      }
      return newArr;
    }
    console.log(qu0(arr));
  </script>
</head>
<body>
  
</body>
</html>